feat(FR-2606): restore BUI i18n context isolation under Vite dep optimization#6870
Merged
graphite-app[bot] merged 1 commit intomainfrom Apr 30, 2026
Conversation
Contributor
Author
This was referenced Apr 22, 2026
Merged
bf0e617 to
7cb1e84
Compare
5536f7b to
7d337b6
Compare
This was referenced Apr 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Restores Backend.AI WebUI host-app i18n context isolation from backend.ai-ui under Vite’s dependency optimization, preventing BUI’s I18nextProvider from leaking into the host tree during dev.
Changes:
- Exclude
i18next/react-i18nextfrom Vite dep optimization to preserve pnpm’s per-package module instances (and thus separate React Contexts). - Add Vite resolve aliases to ESM shim modules for CJS-only transitive deps (
void-elements,use-sync-external-store/shim) that would otherwise break when optimization is skipped. - Document the i18n isolation root cause/fix in Vite PoC notes and add a Playwright smoke test as a regression reproducer.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| react/vite.config.ts | Excludes i18n deps from optimizeDeps and adds shim aliases; clarifies dedupe intent for other shared singletons. |
| react/vite-shims/void-elements.mjs | Provides an ESM default-export shim for the CJS-only void-elements package. |
| react/vite-shims/use-sync-external-store-shim.mjs | Provides an ESM shim exporting React’s native useSyncExternalStore for the CJS-only shim entrypoint. |
| react/VITE_POC_NOTES.md | Adds Phase 1 documentation detailing the i18n context isolation issue and the adopted fix. |
| e2e/vite-poc-smoke.spec.ts | Adds a smoke test intended to guard against the i18n leakage regression during the Vite PoC. |
7cb1e84 to
c115607
Compare
5e5dc8f to
ef09849
Compare
ef09849 to
906250d
Compare
c115607 to
7807fa6
Compare
This was referenced Apr 30, 2026
Merge activity
|
…mization (#6870) Resolves #6809(FR-2606) ## Summary Follow-up fix after the initial Vite PoC uncovered that BUI's i18n instance was bleeding into the host app. **Root cause**: BUI intentionally maintains its OWN i18n singleton (see `BAIConfigProvider`'s `<I18nextProvider i18n={buiI18n}>`). Under pnpm's per-package copies (split by TypeScript peer version), the two `react-i18next` copies had *different* React Context objects, so BUI's Provider published to its own Context and the host read from its own Context. Clean isolation. Under Vite's default dep optimizer the two copies were collapsed into a single bundled module → one Context object → BUI's Provider leaked, and host components resolved their keys against BUI's (BUI-only) resource set, rendering raw keys. **Fix**: `optimizeDeps.exclude: ['i18next', 'react-i18next']` preserves natural pnpm-per-package resolution so the two Context objects stay distinct. ## Test plan - [x] Raw i18n keys no longer render on login/dashboard under `vite:dev` - [x] BUI's own keys still resolve via BUI's Provider - [x] Host's own keys resolve via host's Provider ## Stack Builds on FR-2606 PoC phase 1. Continues the Vite migration series.
7807fa6 to
4ac49a9
Compare
906250d to
3e8d20c
Compare
Base automatically changed from
04-20-feat_fr-2606_vite_poc_phase_1_dev_server_hmr_react_compiler_parity
to
main
April 30, 2026 12:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Resolves #6809(FR-2606)
Summary
Follow-up fix after the initial Vite PoC uncovered that BUI's i18n instance was bleeding into the host app.
Root cause: BUI intentionally maintains its OWN i18n singleton (see
BAIConfigProvider's<I18nextProvider i18n={buiI18n}>). Under pnpm's per-package copies (split by TypeScript peer version), the tworeact-i18nextcopies had different React Context objects, so BUI's Provider published to its own Context and the host read from its own Context. Clean isolation.Under Vite's default dep optimizer the two copies were collapsed into a single bundled module → one Context object → BUI's Provider leaked, and host components resolved their keys against BUI's (BUI-only) resource set, rendering raw keys.
Fix:
optimizeDeps.exclude: ['i18next', 'react-i18next']preserves natural pnpm-per-package resolution so the two Context objects stay distinct.Test plan
vite:devStack
Builds on FR-2606 PoC phase 1. Continues the Vite migration series.